#include "gameover.h"
#include "graphicsmanager.h"
#include "statemanager.h"

Gameover::Gameover(): r(0), g(0), b(0) {
}

void Gameover::Draw() {
    GraphicsManager::DrawRectangle(0,0,800,600,Color(r,g,b));
    if (StateManager::Instance->Winner == Teams::Player) {
        GraphicsManager::DrawString(380, 292, "You win!");
    }
    else {
        GraphicsManager::DrawString(350, 292, "You lose. :(");
    }

}

static double mod(double left, double right) {
    while (left > right) {
        left -= right;
    }
    return left;
}

void Gameover::Update() {
    r = mod(r+0.001, 1);
    g = mod(g+0.002, 1);
    b = mod(b+0.003, 1);

}
